<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>cache</title>
    <script src="../../vue.js/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <p>present time: {{now}}</p>
      <p>present time: {{nowMethods()}}</p>
      <p>{{count}}</p>
      <button @click="add">add+1</button>
    </div>

    <script>
      new Vue({
        el: "#app",
        data() {
          return {
            count: 1,
          }
        },
        methods: {
          add: function() {
            this.count++
          },
          nowMethods() {
            console.log('methods执行了');
            return new Date().toLocaleString();
          }
        },
        computed: {
          now: function () {
            console.log('computed执行了');
            return new Date().toLocaleString();
          },
        },
      });
    </script>
  </body>
</html>
